package ConversationClasses 
{
	import CharacterTraits.PersonalityLevel;
	import org.flixel.FlxPoint;
	import StoryGeneration.Relationship;
	import org.flixel.FlxU;
	
	public class Introduction 
	{
		private static const recentlySpokeTimeMin:uint = 10;
		
		public static function GetIntroduction(target:Character):String
		{
			var temp:String = "";
			
			if (Conversation.talkingTo == Conversation.lastSpokeTo && ConversationHistory.lastConversationTime < recentlySpokeTimeMin)
			{
				//speaking again to same npc within short amount of time
				temp = getQuickRepeatPhrase(target);
			}
			else
			{
				if (!target.conversationHistory.introduced)
				{
					//first introduction
					temp = FirstGreetingPhrase(target) + CharacterSpecific.getNameIntroPhrase(target);
					
					target.conversationHistory.introduced = true;
				}
				else
				{
					temp = GreetingPhrase(target);
				}
			}
			
			return temp;
		}
		
		public static function giveName(target:Character):String
		{
			var temp:String = "";
			
			temp = CharacterSpecific.getNameIntroPhrase(target) + " " + Conversation.GetCharacterName(target);
			
			return temp;
		}
		
		private static function getQuickRepeatPhrase(target:Character):String
		{
			var temp:String = "";
			
			temp = Conversation.GetRandomPhrase(target.personality, new Phrase("Back already?", new ConvRange(), new ConvRange(), new ConvRange(), new ConvRange(), new ConvRange()), 
												new Phrase("Back so soon?", new ConvRange(), new ConvRange(), new ConvRange(), new ConvRange(), new ConvRange()), 
												new Phrase("Hello again.", new ConvRange(), new ConvRange(), new ConvRange(), new ConvRange(), new ConvRange()), 
												new Phrase("Did you forget something?", new ConvRange(), new ConvRange(), new ConvRange(), new ConvRange(), new ConvRange()), 
												new Phrase("You again?", new ConvRange(), new ConvRange(PersonalityLevel.NO_BOTTOM, PersonalityLevel.LOW), new ConvRange(), new ConvRange(), new ConvRange()));
			
			return temp;
		}
		
		private static function FirstGreetingPhrase(target:Character):String
		{
			var temp:String = "";
			
			temp = Conversation.GetRandomPhrase(target.personality, new Phrase("Hello %D, ", new ConvRange(), new ConvRange(), new ConvRange(), new ConvRange(), new ConvRange()), 
												new Phrase("Good day %D, ", new ConvRange(), new ConvRange(), new ConvRange(), new ConvRange(), new ConvRange()),
												new Phrase("How are you %D, ", new ConvRange(), new ConvRange(), new ConvRange(), new ConvRange(), new ConvRange()), 
												new Phrase("Ah, %D, ", new ConvRange(), new ConvRange(), new ConvRange(), new ConvRange(), new ConvRange()), 
												new Phrase("Pleasure to see you %D, ", new ConvRange(), new ConvRange(), new ConvRange(), new ConvRange(), new ConvRange()), 
												new Phrase("Nice to see you %D, ", new ConvRange(), new ConvRange(), new ConvRange(), new ConvRange(), new ConvRange()),
												new Phrase("How do you do %D, ", new ConvRange(), new ConvRange(), new ConvRange(), new ConvRange(), new ConvRange()));
			
			return temp;
		}
		
		private static function GreetingPhrase(target:Character):String
		{
			var temp:String = "";
			
			temp = Conversation.GetRandomPhrase(target.personality, 
												new Phrase("Hello %D.", new ConvRange(PersonalityLevel.NO_BOTTOM, PersonalityLevel.MEDIUM), new ConvRange(), new ConvRange(PersonalityLevel.NO_BOTTOM, PersonalityLevel.MEDIUM), new ConvRange(), new ConvRange()), 
												new Phrase("Hello.", new ConvRange(PersonalityLevel.NO_BOTTOM, PersonalityLevel.MEDIUM), new ConvRange(), new ConvRange(PersonalityLevel.NO_BOTTOM, PersonalityLevel.MEDIUM), new ConvRange(), new ConvRange()), 
												new Phrase("Good day %D.", new ConvRange(), new ConvRange(), new ConvRange(PersonalityLevel.NO_BOTTOM, PersonalityLevel.MEDIUM), new ConvRange(), new ConvRange()),
												new Phrase("Good day.", new ConvRange(), new ConvRange(), new ConvRange(PersonalityLevel.NO_BOTTOM, PersonalityLevel.MEDIUM), new ConvRange(), new ConvRange()),
												new Phrase("How are you %D?", new ConvRange(), new ConvRange(PersonalityLevel.MEDIUM, PersonalityLevel.NO_TOP), new ConvRange(), new ConvRange(), new ConvRange()), 
												new Phrase("How are you?", new ConvRange(), new ConvRange(PersonalityLevel.MEDIUM, PersonalityLevel.NO_TOP), new ConvRange(), new ConvRange(), new ConvRange()), 
												new Phrase("Ah, %D, pleasure as always.", new ConvRange(), new ConvRange(), new ConvRange(), new ConvRange(PersonalityLevel.MEDIUM, PersonalityLevel.NO_TOP), new ConvRange()), 
												new Phrase("Pleasure to see you %D.", new ConvRange(PersonalityLevel.LOW, PersonalityLevel.HIGH), new ConvRange(), new ConvRange(), new ConvRange(), new ConvRange()), 
												new Phrase("Pleasure to see you.", new ConvRange(PersonalityLevel.LOW, PersonalityLevel.HIGH), new ConvRange(), new ConvRange(), new ConvRange(), new ConvRange()), 
												new Phrase("Nice to see you again %D.", new ConvRange(PersonalityLevel.LOW, PersonalityLevel.HIGH), new ConvRange(), new ConvRange(), new ConvRange(), new ConvRange()),
												new Phrase("Nice to see you again.", new ConvRange(PersonalityLevel.LOW, PersonalityLevel.HIGH), new ConvRange(), new ConvRange(), new ConvRange(), new ConvRange()),
												new Phrase("Have you found anything %D?", new ConvRange(), new ConvRange(), new ConvRange(), new ConvRange(), new ConvRange(PersonalityLevel.LOW, PersonalityLevel.NO_TOP)), 
												new Phrase("Have you found anything?", new ConvRange(), new ConvRange(), new ConvRange(), new ConvRange(), new ConvRange(PersonalityLevel.LOW, PersonalityLevel.NO_TOP)), 
												new Phrase("How is everything %D?", new ConvRange(), new ConvRange(PersonalityLevel.LOW, PersonalityLevel.NO_TOP), new ConvRange(), new ConvRange(), new ConvRange(PersonalityLevel.LOW, PersonalityLevel.NO_TOP)),
												new Phrase("How is everything?", new ConvRange(), new ConvRange(PersonalityLevel.LOW, PersonalityLevel.NO_TOP), new ConvRange(), new ConvRange(), new ConvRange(PersonalityLevel.LOW, PersonalityLevel.NO_TOP)),
												new Phrase("I trust that everything is going well %D.", new ConvRange(), new ConvRange(), new ConvRange(), new ConvRange(), new ConvRange()),
												new Phrase("I trust that everything is going well.", new ConvRange(), new ConvRange(), new ConvRange(), new ConvRange(), new ConvRange()),
												new Phrase("How are things with you %D?", new ConvRange(), new ConvRange(), new ConvRange(), new ConvRange(), new ConvRange()),
												new Phrase("What's up %D?", new ConvRange(PersonalityLevel.MEDIUM, PersonalityLevel.NO_TOP), new ConvRange(), new ConvRange(PersonalityLevel.MEDIUM, PersonalityLevel.NO_TOP), new ConvRange(), new ConvRange()),
												new Phrase("What's up?", new ConvRange(PersonalityLevel.MEDIUM, PersonalityLevel.NO_TOP), new ConvRange(), new ConvRange(PersonalityLevel.MEDIUM, PersonalityLevel.NO_TOP), new ConvRange(), new ConvRange()),
												new Phrase("Is there anything you need %D?", new ConvRange(), new ConvRange(PersonalityLevel.MEDIUM, PersonalityLevel.NO_TOP), new ConvRange(), new ConvRange(PersonalityLevel.MEDIUM, PersonalityLevel.NO_TOP), new ConvRange()),
												new Phrase("Is there anything you need?", new ConvRange(), new ConvRange(PersonalityLevel.MEDIUM, PersonalityLevel.NO_TOP), new ConvRange(), new ConvRange(PersonalityLevel.MEDIUM, PersonalityLevel.NO_TOP), new ConvRange()),
												new Phrase("Can I help you %D?", new ConvRange(), new ConvRange(), new ConvRange(), new ConvRange(PersonalityLevel.MEDIUM, PersonalityLevel.NO_TOP), new ConvRange()),
												new Phrase("Can I help you?", new ConvRange(), new ConvRange(), new ConvRange(), new ConvRange(PersonalityLevel.MEDIUM, PersonalityLevel.NO_TOP), new ConvRange()),
												new Phrase("Hi.", new ConvRange(PersonalityLevel.NO_BOTTOM, PersonalityLevel.MEDIUM), new ConvRange(), new ConvRange(PersonalityLevel.NO_BOTTOM, PersonalityLevel.MEDIUM), new ConvRange(), new ConvRange()),
												new Phrase("Hi %D.", new ConvRange(PersonalityLevel.NO_BOTTOM, PersonalityLevel.MEDIUM), new ConvRange(), new ConvRange(PersonalityLevel.NO_BOTTOM, PersonalityLevel.MEDIUM), new ConvRange(), new ConvRange()),
												new Phrase("Hi there.", new ConvRange(PersonalityLevel.MEDIUM, PersonalityLevel.NO_TOP), new ConvRange(), new ConvRange(), new ConvRange(), new ConvRange()),
												new Phrase("Hi there %D.", new ConvRange(PersonalityLevel.MEDIUM, PersonalityLevel.NO_TOP), new ConvRange(), new ConvRange(), new ConvRange(), new ConvRange()));
			
			return temp;
		}
	}
}